import request from '@/utils/qrequest'

enum API {
  GETUUID = '/qlogin',
  GETQUSERINFO = '/qtoken',
  REFRESHTOKEN = '/qrefresh',
  GETAREA = '/qarea',
  GETAREAECON = '/qarea/econ',
}

export const reqQyyjtUUID = () => request.get(API.GETUUID)
export const reqQyyjtUserToken = (uuid: string) =>
  request.get(API.GETQUSERINFO, { params: { uuid } })
// request({
//   url: API.GETQUSERINFO,
//   method: 'get',
//   params: { uuid },
// })
export const reqRefreshToken = (data) => request.post(API.REFRESHTOKEN, data)

// 业务相关api
// 区域信息获取
export const reqQArea = () => request.post(API.GETAREA)
// 要对user解构，否则flask会收到一个{user:user}的数组
export const reqQAreaEcon = (area_code) =>
  request.post(API.GETAREAECON, area_code)
